import java.util.*;
class Student{
    public String id;
    public Student(String id) {
        this.id = id;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return Objects.equals(id, student.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }
}

public class Test {
    public static void main(String[] args) {
        Student student1 = new Student("123");
        Student student2 = new Student("123");

        System.out.println(student1.hashCode());
        System.out.println(student2.hashCode());
    }
    public static void main2(String[] args) {
        Set<String> set = new TreeSet<>();
        set.add("sunny");
        set.add("hello");
        set.add("the");

        System.out.println(set);

        Iterator<String> stringIterator =  set.iterator();


    }
    public static void main1(String[] args) {
        TreeMap<String,Integer> map = new TreeMap<>();
        map.put("sunny",3);
        map.put("the",5);
        map.put("hello",2);
        map.put("hello",21);

        //Integer val = map.getOrDefault("the2",99999);
        Integer val = map.getOrDefault("the",99999);
        System.out.println(val);

        Set<String> set = map.keySet();
        System.out.println(set);
        System.out.println(map);

        Set<Map.Entry<String,Integer>> entrySet = map.entrySet();
        for(Map.Entry<String,Integer> entry:entrySet) {
            System.out.println("key: " + entry.getKey()+" value: " + entry.getValue() );
        }
    }
}
